package com.lanyou.esb.datadictionary;

import java.rmi.NoSuchObjectException;

import org.apache.commons.lang3.StringUtils;

/**
 * 请求结果类型<br>
 * 描述：<br>
 * 0:成功;1:失败;
 * 
 * @author Davey.wu
 */
public enum RequestResultType {

	FAILURE("0"), SUCCEED("1");

	public static final String TypeCode = "10001";

	public final String ValueCode;

	private RequestResultType(String code) {
		this.ValueCode = code;
	}

	public static RequestResultType get(String valueCode)
			throws NoSuchObjectException {
		if (StringUtils.isEmpty(valueCode)) {
			throw new NullPointerException();
		}
		for (RequestResultType type : RequestResultType.values()) {
			if (type.ValueCode.equals(valueCode)) {
				return type;
			}
		}
		throw new NoSuchObjectException(valueCode);
	}
}
